#pragma once

#include <string>
#include "Singleton.h"
#include "gameinfo.h"


class GameInfoMgr
{
public:
    GameInfoMgr();
    virtual ~GameInfoMgr();

public:
    static GameInfoMgr* Instance()
	{
		return CSingleton<GameInfoMgr>::Instance();
	}

public:
	stGameInfo* Get(const std::uint32_t game, const std::uint32_t agency_id);
	stGameInfo* RefreshGet(const std::uint32_t game, const std::uint32_t agency_id);

protected:
	inline std::uint64_t MakeUuid(const std::uint32_t game, const std::uint32_t agency_id)
	{
		std::uint64_t uuid = game;
		uuid = (uuid << 32) | agency_id;
		return uuid;
	}
	inline void GetByUuid(std::uint32_t& game, std::uint32_t& agency_id, const std::uint64_t uuid)
	{
		const std::uint64_t mask = (1ull << 32) - 1;
		agency_id = uuid & mask;
		game = uuid >> 32;
	}

private:
    std::map<std::uint64_t, stGameInfo> m_gameinfos;
};












